

<%@page import="cs4280.dao.MovieDAO"%>
<%--
    Document   : index
    Created on : 2011-3-22, 11:19:34
    Author     : PangPei
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList, java.util.Iterator, cs4280.bean.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Cult Cinema</title>
        <meta name="keywords" content="" />
        <meta name="description" content="This web site exists to fulfill the coursework requirement of CS4280.
              Do not use your real personal data as input." />
        <link href="default.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="jquery/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="jquery/jquery.slidertron-0.1.js"></script>
        <script type="text/javascript" src="jquery.twitter.js"></script>
        <link rel="stylesheet" href="jquery.twitter.css" type="text/css" media="all"/>
        <style type="text/css">

            @import "gallery.css";

        </style>


    </head>
    <body><div id="wrapper">
            <div id="header">
                <div id="logo">
                    <h1><a href="#">CultCinema </a></h1>
                    <h2><a href="#">By Phoena and Yvonne</a></h2>
                </div>

                <!-- end div#logo -->

                <div id="menu">
                    <ul>
                        <form name="home" id="home" method="post" action="index.do">
                            <li ><a onclick="home.submit();">Homepage</a></li>
                        </form>
                        <form name="movie" id="movie" method="post" action="movieControl.do">
                            <li ><a onclick="movie.submit();" >Movies</a></li>
                        </form>

                        <form name="discuss" id="discuss" method="post" action="/assignmentCinema/">
                            <input type="hidden" name="todo" id="todo" value="messageBox" />
                            <li><a onclick="discuss.submit();">Discuss</a></li>
                        </form>

                        <form name="manage" id="manage" method="post" action="memberControl.do">
                            <li class="active"><a onclick="manage.submit();">Manage</a></li>
                        </form>
                    </ul>
                </div>

                <!-- end div#menu -->

            </div>
        </div>

        <div>
            <div id="page">
                <div id="page-bgtop">
                    <div id="content">
                        <div id="gallery-bg">
                            <div id="gallery-bgtop">
                                <div id="gallery-bgbtm">
                                    <div id="foobar">
                                        <div class="navigation"> <a href="#" class="first">[ &lt;&lt; ]</a> &nbsp; <a href="#" class="previous">[ &lt; ]</a> &nbsp; <a href="#" class="next">[ &gt; ]</a> &nbsp; <a href="#" class="last">[ &gt;&gt; ]</a> </div>

                                        <div class="viewer">
                                            <div class="reel">
                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>Phoena and Yvonne.</span> </div>
                                                <div class="slide"> <img src="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2011/soldier-character/vector-soldier-character.jpg" alt=""> <span>Phoena.</span> </div>
                                                <div class="slide"> <img src="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2010/reindeer/reindeer-character-sm.jpg" alt=""> <span>Yvonne.</span> </div>
                                                <div class="slide"> <img src="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2009/12/1.png" alt=""> <span>Phoena and Yvonne.</span> </div>
                                            </div>
                                        </div>
                                    </div>
                                    <script type="text/javascript">

                                        $('#foobar').slidertron({
                                            viewerSelector:			'.viewer',
                                            reelSelector:			'.viewer .reel',
                                            slidesSelector:			'.viewer .reel .slide',
                                            navPreviousSelector:	'.previous',
                                            navNextSelector:		'.next',
                                            navFirstSelector:		'.first',
                                            navLastSelector:		'.last'
                                        });
                                    </script>
                                    <!-- end -->

                                </div>
                            </div>
                        </div>
                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry">

                                        <%@page import="java.util.Iterator"%>
                                        <%@page import="cs4280.bean.Movie"%>
                                        <%@page import="java.util.ArrayList"%>
                                        <script type="text/javascript">

                                            function doPrepareAddMovie() {
                                                document.getElementById("frmMovieManager").todo.value = "addmovie";

                                                document.getElementById("frmMovieManager").submit();

                                            }

                                            function doPrepareUpdateMovie() {
                                                document.getElementById("frmMovieManager").todo.value = "updatemovie";
                                                document.getElementById("frmMovieManager").submit();

                                            }

                                            function doManageScreening() {
                                                document.getElementById("frmMovieManager").todo.value = "managescreening";
                                                document.getElementById("frmMovieManagere").submit();

                                            }

                                            function doPrepareDeleteMovie() {
                                                document.getElementById("frmMovieManager").todo.value = "deletemovie";
                                                document.getElementById("frmMovieManager").submit();

                                            }

                                            function searchMovie() {
                                                if (document.getElementById("keyword").value.length>0)
                                                    document.getElementById("searchM").submit();
                                                else
                                                    alert("Please input the keyword to search");

                                            }

                                            

                                        </script>
                                        <h1>Movie Manager</h1>
                                        <h2>Sort Movie</h2>

                                        <form name="sortM" id="sortM" method="post" action="/assignmentCinema/">
                                            <input type="hidden" id="todo" name="todo" value="doSortManager" />
                                            <label>Sort by:</label>
                                            <select name="sortStrategy" id="sortStrategy">
                                                <option>Name</option>
                                                <option>Genre</option>
                                                <option>Duration</option>
                                            </select>
                                            <label>Order:</label>
                                            <input type="radio" name="order" value="ascending" checked="true"/> Ascending
                                            <input type="radio" name="order" value="descending" /> Descending
                                            <label>Show:</label>
                                            <input type="radio" name="numberPerPage" value="5" /> 5
                                            <input type="radio" name="numberPerPage" value="10" /> 10
                                            <input type="radio" name="numberPerPage" value="all" checked="true"/>all
                                            <input type="submit" id="sort" value="Sort" />
                                        </form>
                                        <br/>

                                        <h2>Search Movie</h2>

                                        <form name="searchM" id="searchM" method="post" action="/assignmentCinema/">
                                            <input type="hidden" id="todo" name="todo" value="doSearchManager" />
                                            Enter keyword(s) to look for all types of movies.<br />
                                            <input type="text" name="keyword" id="keyword" value="" />
                                            <input type="button" value="search" id="searchSubmit" onclick="searchMovie();" />
                                        </form>
                                        <br/>

                                        <h2>Movie List</h2>
                                        <form name="frmMovieManager" id="frmMovieManager" method="post" action="/assignmentCinema/">
                                            <input type="hidden" name="todo" id="todo" value="" />
                                            <%  ArrayList<Movie> movies =
                                                                (ArrayList<Movie>) request.getAttribute("movies");

                                                        if (movies.size() == 0) {
                                                            movies = (ArrayList<Movie>) request.getAttribute("allmovies");
                                                            out.println("No movie found, return all movies!");


                }%>

                                            <table>
                                                <thead>
                                                    <tr>
                                                        <th>Select</th>
                                                        <th>Movie</th>
                                                        <th>Duration</th>
                                                        <th>Genre</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <%


                                                                Iterator<Movie> it = movies.iterator();
                                                                while (it.hasNext() != false) {
                                                                    pageContext.setAttribute("movie", (Movie) it.next());
                                                    %>
                                                    <jsp:useBean id="movie" type="cs4280.bean.Movie" scope="page"/>

                                                    <tr>
                                                        <td><input type="radio" name="moviename" value="<%=movie.getName()%>"/> </td>
                                                        <td><%=movie.getName()%></td>
                                                        <td><%=movie.getDuration()%></td>
                                                        <td><%=movie.getGenere()%></td>
                                                    </tr>

                                                    <jsp:scriptlet>}</jsp:scriptlet>


                                                </tbody>




                                            </table>
<br/>
                                            <input type="submit" onclick="doPrepareUpdateMovie();" value="Update" />
                                            <input type="submit" onclick="doPrepareDeleteMovie();" value="Delete" />

                                            <input type="submit"  onclick="doPrepareAddMovie();" value="Add new movie" />
                                            <input type="submit"  onclick="doManageScreening();" value="Manage Screening" />
                                      

                                        </form>


                                    </div>
                                </div>
                            </div>
                        </div>


                    </div>

                    <!-- end div#content -->

                    <jsp:include page="/WEB-INF/jsp/_sidebar.jsp"/>

                    <!-- end div#sidebar -->

                    <div style="clear: both; height: 1px"></div>
                </div>
            </div>
            <!-- end div#page -->

        </div>
        <!-- end div#wrapper -->

        <div id="footer-wrapper">
            <div id="footer">
                <p id="legal">Copyright &copy; 2007 CYPP . All Rights Reserved. Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
                <p id="links"><a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a></p>
            </div>
        </div>

        <!-- end div#footer -->

    </body>
</html>

